﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IntelligentQuery.Model;

namespace IntelligentQuery.TransformProviders
{
    public class DateBlockTransformProvider : ITransformProvider
    {
        public bool Match(ConditionItem item, Type type)
        {
            return item.Method == QueryMethod.DateBlock;
        }

        public IEnumerable<ConditionItem> Transform(ConditionItem item, Type type)
        {
            return new[]
                       {
                           new ConditionItem { Field = item.Field, Method = QueryMethod.GreaterThanOrEqual, Value =    item.Value},
                           new ConditionItem { Field = item.Field, Method = QueryMethod.LessThan, Value = item.Value}
                       };
        }
    }
}
